package zw_501_600.zw_504_七进制数;

class Solution {

    public static void main(String[] args) {
        int num = -10;
        String s = convertToBase7(num);
        System.out.println(s);
    }

    public static String convertToBase7(int num) {
        boolean b = num < 0;
        if (b) num = -num;
        StringBuilder ans = new StringBuilder();
        do {
            ans.append(num % 7);
            num /= 7;
        } while (num != 0);
        ans.append(b == true ? "-" : "");
        return ans.reverse().toString();
    }
}
